package com.itheima.day06;

import java.util.*;

public class Test5 {
    public static void main(String[] args) {
        List<String> list=new ArrayList<>();

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入商品名称,每行输入一个,以end结束");
        while (true) {
            String tradeName = scanner.next();
            if (tradeName.equals("end")) {
                break;
            }
            list.add(tradeName);

        }

        Map<String,Integer> map=new HashMap<>();
        for (String s : list) {
            if (!map.containsKey(s)) {
                map.put(s,1);
            }else {
                map.put(s,map.get(s)+1);
            }
        }
        System.out.println(map);
    }
}
